package com.gree.email.scm;


import com.gree.common.msgfrt.email.EmailMsg;
import com.gree.common.utils.MailUtils;
import com.threadnew.tnmq.common.ConsumerMessageListener;
import com.threadnew.tnmq.common.ConsumerStatus;
import org.apache.rocketmq.common.message.MessageExt;
import org.springframework.stereotype.Component;

/**
 * @ClassName EmailMsgConsumer
 * @Description TODO  邮件处理
 * @Author ThreadNew
 * @Date 2021/5/19 17:46
 * Version 1.0
 **/
@Component
public class EmailMsgConsumer implements ConsumerMessageListener {


    @Override
    public ConsumerStatus handle(Object o, MessageExt messageExt) throws Exception {
        try {
          MailUtils.invokeMethord((EmailMsg) o);
        } catch (Exception e) {
            return ConsumerStatus.FAIL;
        }
        return ConsumerStatus.OK;
    }
}
